package com.sgb.kjwl.view.ui.activity.self.shop;

import android.content.Context;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.View;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityCompanyBriefIntroductionBinding;
import com.swgk.core.event.EventConstant;
import com.sgb.kjwl.view.event.self.ShopEvent;
import com.swgk.core.base.di.AppComponent;

import org.greenrobot.eventbus.EventBus;

public class CompanyBriefIntroductionActivity extends AppActivity {
    private ActivityCompanyBriefIntroductionBinding binding;
    private String content;

    public static void start(Context context, String content) {
        Intent intent = new Intent(context, CompanyBriefIntroductionActivity.class);
        intent.putExtra("content", content);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initView() {
        binding = DataBindingUtil.setContentView(CompanyBriefIntroductionActivity.this, R.layout.activity_company_brief_introduction);
        content = getIntent().getStringExtra("content");
        binding.companyInfoEt.setText(content);
        binding.saveTv.setOnClickListener(this);
    }

    @Override
    protected void init() {

    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.save_tv:
                EventBus.getDefault().post(ShopEvent.make().setMessageTag(EventConstant.EVENT_SHOP_COMPANY_INFO).setMessageData(binding.companyInfoEt.getText()));
                finish();
                break;
        }
    }


}
